﻿<UserControl x:Class="EmployeeTracker.View.EmployeeContactsDetailView"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:v="clr-namespace:EmployeeTracker.View"
             xmlns:vm="clr-namespace:EmployeeTracker.ViewModel"
             mc:Ignorable="d"
             d:DesignWidth="300"
             d:DesignHeight="200">

    <UserControl.Resources>
        <DataTemplate DataType="{x:Type vm:PhoneViewModel}">
            <v:PhoneDetailView  Margin="0,2,0,0" />
        </DataTemplate>
        <DataTemplate DataType="{x:Type vm:EmailViewModel}">
            <v:EmailDetailView  Margin="0,2,0,0" />
        </DataTemplate>
        <DataTemplate DataType="{x:Type vm:AddressViewModel}">
            <v:AddressDetailView  Margin="0,2,0,0" />
        </DataTemplate>
    </UserControl.Resources>

    <Grid>
        <HeaderedContentControl>
            <HeaderedContentControl.Header>
                <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
                    <TextBlock Margin="2">
                        <Hyperlink Command="{Binding Path=AddPhoneNumberCommand}">Add Phone</Hyperlink>
                        | <Hyperlink Command="{Binding Path=AddEmailAddressCommand}">Add Email</Hyperlink>
                        | <Hyperlink Command="{Binding Path=AddAddressCommand}">Add Address</Hyperlink>
                        | <Hyperlink Command="{Binding Path=DeleteContactDetailCommand}">Delete</Hyperlink>
                    </TextBlock>
                </StackPanel>
            </HeaderedContentControl.Header>

            <ListBox BorderThickness="0" SelectedItem="{Binding Path=CurrentContactDetail, Mode=TwoWay}" ItemsSource="{Binding Path=ContactDetails}" />
        </HeaderedContentControl>
    </Grid>
</UserControl>
